/*
 * @Description: Description
 * @Author: laoyuan
 * @Date: 2023-03-30 11:14:57
 */
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
// import 'amfe-flexible';
import { setupDirectives } from './directives';
import Toast from './plugins/toast/index';
import '@/assets/styles/common.scss';
// 自动导入时，Element-plus Message Box组件样式丢失, 所以需手动导入样式。
import 'element-plus/theme-chalk/el-message.css';
import 'element-plus/theme-chalk/el-message-box.css';
// 全局注册element-plus/icons-vue
import * as ElementPlusIconsVue from '@element-plus/icons-vue';

const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 注册全局自定义指令，如：v-throttle
setupDirectives(app);

// 注册全局插件方法
app.use(Toast);

// 获取原型
const prototype = app.config.globalProperties;
// 绑定参数
prototype.appId = '131...';

app.use(router);
app.use(store);
// 路由准备完毕再挂载
router.isReady().then(() => app.mount('#app'));
